a few words about web development

[MySQL] How to remove duplicate rows- the fast way

Another straight to the point solution
Below there are two simple and fast methods useful in removing duplicate rows from a MySQL table.

Method 1
Let's create a new unique index, like this:
ALTER IGNORE TABLE `mytab` ADD UNIQUE INDEX(`mycol`)

Method 2
Create a new table and copy content from old table to new one:
INSERT IGNORE INTO `mytab2`
SELECT * FROM `mytab`

Comments